//
//  KAAboutViewController.m
//  KeepAccount
//
//  Created by Veer on 2017/12/26.
//  Copyright © 2017年 Veer. All rights reserved.
//

#import "KAAboutViewController.h"

@interface KAAboutViewController ()

@end

@implementation KAAboutViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
    // app名称
    NSString *app_Name = [infoDictionary objectForKey:@"CFBundleDisplayName"];
    // app版本
    NSString *app_Version = [infoDictionary objectForKey:@"CFBundleShortVersionString"];
    self.title = [NSString stringWithFormat:@"关于%@", app_Name];
    self.view.backgroundColor = [UIColor whiteColor];
    
    [self setupSubView];
    
}

- (void)setupSubView
{
    UIImageView *imgView = [[UIImageView alloc] init];
    imgView.contentMode = UIViewContentModeScaleAspectFit;
    imgView.image = [UIImage imageNamed:@"about_pic"];
    [self.view addSubview:imgView];
    [imgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(66 + NAVIGATION_BAR_HEIGHT);
        make.left.mas_equalTo(self.view);
        make.width.mas_equalTo(self.view);
        make.height.mas_equalTo(204);
    }];
    
    NSDictionary *infoDictionary = [[NSBundle mainBundle] infoDictionary];
    // app名称
    NSString *app_Name = [infoDictionary objectForKey:@"CFBundleDisplayName"];
    
    // app icon
    UIImageView *iconImgView = [[UIImageView alloc] init];
    iconImgView.contentMode = UIViewContentModeScaleAspectFit;
    iconImgView.image = [UIImage imageNamed:@"app_icon"];
    iconImgView.layer.cornerRadius = 10;
    iconImgView.layer.masksToBounds = YES;
    [imgView addSubview:iconImgView];
    [iconImgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(63);
        make.centerX.mas_equalTo(imgView);
        make.width.mas_equalTo(60);
        make.height.mas_equalTo(60);
    }];
    
    // app名称
    UILabel *appNameLbl = [[UILabel alloc] init];
    appNameLbl.text = [NSString stringWithFormat:@"%@", app_Name];
    appNameLbl.textColor = RGB(51, 51, 51);
    appNameLbl.font = VRFont(20);
    appNameLbl.textAlignment = NSTextAlignmentCenter;
    [imgView addSubview:appNameLbl];
    [appNameLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(iconImgView.mas_bottom).offset(13);
        make.centerX.mas_equalTo(imgView);
    }];
    
    UILabel *titleLbl = [[UILabel alloc] init];
    titleLbl.text = [NSString stringWithFormat:@"财务自由从%@开始", app_Name];
    titleLbl.textColor = RGB(153, 153, 153);
    titleLbl.font = VRFont(18);
    titleLbl.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:titleLbl];
    [titleLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(imgView.mas_bottom).offset(20);
        make.centerX.mas_equalTo(self.view);
    }];
}

@end
